package com.hjp.redis.web;

import com.hjp.redis.client.RedisClient;
import com.hjp.redis.server.impl.IXxSV;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: huangjp6
 * @Description:
 * @Date: 2021/8/24 18:01
 */
@RestController
@RequestMapping("/hello")
public class HelloWorldController {
    @Autowired
    private IXxSV iXxSV;

    @Autowired
    private ApplicationContext context;

    @RequestMapping("/say")
    public String say() {
        iXxSV.fun();
        RedisClient redisClient = context.getBean(RedisClient.class);
        Boolean result = redisClient.set("xx", "xxx", "NX", "EX", 10000L);
        System.out.println(" set = " + result);
        iXxSV.fun();
        return "Hello World set =" + result;
    }
}